#************************************************************************
#*   IRC - Internet Relay Chat, Makefile
#*   Copyright (C) 1990, Jarkko Oikarinen
#*
#*   This program is free software; you can redistribute it and/or modify
#*   it under the terms of the GNU General Public License as published by
#*   the Free Software Foundation; either version 1, or (at your option)
#*   any later version.
#*
#*   This program is distributed in the hope that it will be useful,
#*   but WITHOUT ANY WARRANTY; without even the implied warranty of
#*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#*   GNU General Public License for more details.
#*
#*   You should have received a copy of the GNU General Public License
#*   along with this program; if not, write to the Free Software
#*   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#*
#*/

# -------------------------------------------------------------------------
# Start of system configuration section.
#
prefix = @prefix@
exec_prefix = @exec_prefix@

# compiler program
CC = @CC@
# compiler flags used for the server
S_CFLAGS = @CFLAGS@ -I. -I../ircd -I../common -I../rusnet @IRC_ZLIB_INCLUDE@ @IRC_OPENSSL_INCLUDE@
# compiler flags used for the authentication slave
A_CFLAGS = @CFLAGS@ -I. -I../iauth -I../common -I../rusnet @IRC_ZLIB_INCLUDE@ @IRC_OPENSSL_INCLUDE@
# compiler flags used for the configuration slave
IS_CFLAGS = @CFLAGS@ -I. -I../iserv -I../common -I../rusnet -DCLIENT_COMPILE @IRC_ZLIB_INCLUDE@ @IRC_OPENSSL_INCLUDE@
# compiler flags used for chkconfig
CC_CFLAGS = @CFLAGS@ -I. -I../ircd -I../common -I../rusnet @IRC_ZLIB_INCLUDE@ @IRC_OPENSSL_INCLUDE@
# compiler flags used for the client
C_CFLAGS = @CFLAGS@ -I. -I../ircd -I../common -I../rusnet -DCLIENT_COMPILE
# compiler flags used for other things (in contrib/)
O_CFLAGS = @CFLAGS@ -I. -I../common -I../rusnet -DCONTRIB_COMPILE
# linker flags
LDFLAGS = @LDFLAGS@
# required libraries, except zlib,libssl and curses/termcap
LIBS = @LIBS@
MATHLIBS = @MATHLIBS@
# zlib, eventually
ZLIBS = @IRC_ZLIB_LIBRARY@
# openssl lib
SSLLIBS = @IRC_OPENSSL_LIBRARY@
# for DSM support (dlopen(), dlsym(), dlclose())
DLIBS = @IRC_DLIB@
# install and related programs
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
MKDIRHIER = ../support/mkdirhier

#
# Binary names
#
SERVER = ircd
IAUTH = iauth
ISERV = iserv
IRCDWATCH = ircdwatch
#
# Directories definitions
#
# Directory in which to install ircd, iauth, iserv, ircdwatch, mkpasswd and chkconf.
server_bin_dir = @sbindir@
# Directory in which to install the configuration manual page.
conf_man_dir = @mandir@/man5
# Directory in which to install the server manual page.
server_man_dir = @mandir@/man8
# Directory where config files (ircd.conf, ircd.motd and iauth.conf) live.
ircd_conf_dir = @sysconfdir@
# Directory where state files (ircd.pid, ircd.tune) live.
ircd_var_dir = @rundir@
# Directory where log files (users, opers, rejects, iserv and auth) live.
ircd_log_dir = @logdir@
# Directory where codepage files live (only for USE_OLD8BIT).
ircd_codepage_dir = @prefix@/codepages
# Directory where custom locale lives (iconv and Linux only).
ircd_locale_dir = @datadir@

#
# Most of these PATHs are hardcoded in the binaries.
# They should all be absolute.
#
# Path to server binary
IRCD_PATH = $(server_bin_dir)/$(SERVER)
# Path to authentification slave binary
IAUTH_PATH = $(server_bin_dir)/$(IAUTH)
# Path to configuration slave binary
ISERV_PATH = $(server_bin_dir)/$(ISERV)
# Path to the m4 configuration file
IRCDM4_PATH = $(ircd_conf_dir)/ircd.m4
# Path to the main configuration file
IRCDCONF_PATH = $(ircd_conf_dir)/ircd.conf
# Path to the 8-bit codepages configuration file
RUSNETCONF_PATH = $(ircd_conf_dir)/rusnet.conf


# configuration lines server file
KILLSCONF_PATH = $(ircd_conf_dir)/kills.conf
# authentication slave configuration file
IAUTHCONF_PATH = $(ircd_conf_dir)/iauth.conf
# server PID file
IRCDPID_PATH = $(ircd_var_dir)/ircd.pid
# server state file
IRCDTUNE_PATH = $(ircd_var_dir)/ircd.tune
# ircdwatch PID file
IRCDWATCHPID_PATH = $(ircd_var_dir)/ircdwatch.pid
# ircd motd path
IRCDMOTD_PATH = $(ircd_conf_dir)/ircd.motd
# ircd rmotd path
IRCDRMOTD_PATH = $(ircd_conf_dir)/ircd.rmotd

# files used for debugging purposes
IRCDDBG_PATH = $(ircd_log_dir)/ircd.log
IAUTHDBG_PATH = $(ircd_log_dir)/iauth.log
ISERVDBG_PATH = $(ircd_log_dir)/iserv.log

# Access mode for irc.
irc_mode = 755

# Access mode for ircd.
ircd_mode = 711

# End of system configuration section.
# ------------------------------------------------------------------------
# Please don't change anything below this point - no need really - I hope.

RM = rm -f

SERVER_COMMON_OBJS = dbuf.o fileio.o packet.o send.o match.o parse.o \
                     support.o @newconvobjs@
SERVER_OBJS = channel.o class.o hash.o ircd.o ircd_signal.o list.o res.o \
              res_init.o res_comp.o res_mkquery.o @oldconvobjs@ s_auth.o \
              s_bsd.o s_conf.o s_debug.o s_err.o s_id.o s_iserv.o s_misc.o \
              s_numeric.o s_serv.o s_service.o s_user.o ssl.o s_zip.o whowas.o \
              rusnet_misc.o rusnet_cmds.o rusnet_virtual.o

IAUTH_COMMON_OBJS = clsupport.o clmatch.o # This is a little evil
IAUTH_OBJS = iauth.o a_conf.o a_io.o a_log.o mod_webproxy.o \
             mod_lhex.o mod_pipe.o mod_rfc931.o mod_socks.o mod_dnsbl.o

ISERV_COMMON_OBJS = clsupport.o clmatch.o
ISERV_OBJS = iserv.o i_io.o i_log.o \

CHKCONF_COMMON_OBJS = match.o
CHKCONF_OBJS = chkconf.o
CHKCONF = chkconf
CLIENT_DEPS = setup.h config.h ../common/struct_def.h
COMMON_DEPS = config.h setup.h
MATCH_DEPS = ../common/match.c ../common/collsyms.h ../common/sm_loop.c
SERVER_DEPS = $(COMMON_DEPS) ../ircd/s_defines.h ../ircd/s_externs.h
IAUTH_DEPS = $(COMMON_DEPS) ../iauth/a_defines.h ../iauth/a_externs.h
ISERV_DEPS = $(COMMON_DEPS) ../iserv/i_defines.h ../iserv/i_externs.h

all: server

help:
	@echo "Choose one of the following:"
	@echo "        all            : build everything except contrib"
	@echo "        server         : build server programs"
	@echo "                $(SERVER)	: build the irc daemon"
	@echo "                $(IAUTH)		: build the authentication slave"
	@echo "                $(ISERV)		: build the configuration slave"
	@echo "                chkconf		: build the configuration file checker"
	@echo "                ircd-mkpasswd	: build ircd-mkpasswd"
	@echo "                $(IRCDWATCH)	: build ircdwatch"
	@echo
	@echo "        install        : build and install server programs except contrib"


server: $(SERVER) $(IAUTH) $(ISERV) $(CHKCONF) ircd-mkpasswd $(IRCDWATCH)


$(SERVER): $(SERVER_COMMON_OBJS) $(SERVER_OBJS)
	$(RM) $@
	./version.c.SH
	$(CC) $(S_CFLAGS) -c -o version.o version.c
	$(CC) $(LDFLAGS) -o $@ $(SERVER_COMMON_OBJS) version.o $(SERVER_OBJS) $(SSLLIBS) $(ZLIBS) $(MATHLIBS) $(LIBS)

$(IAUTH): $(IAUTH_COMMON_OBJS) $(IAUTH_OBJS)
	$(RM) $@
	$(CC) $(LDFLAGS) -o $@ $(IAUTH_COMMON_OBJS) $(IAUTH_OBJS) $(LIBS) $(DLIBS)

$(ISERV): $(ISERV_COMMON_OBJS) $(ISERV_OBJS)
	$(RM) $@
	$(CC) $(LDFLAGS) -o $@ $(ISERV_COMMON_OBJS) $(ISERV_OBJS) $(LIBS) $(DLIBS)

$(CHKCONF): $(CHKCONF_COMMON_OBJS) $(CHKCONF_OBJS)
	$(RM) $@
	$(CC) $(LDFLAGS) -o $@ $(CHKCONF_COMMON_OBJS) $(CHKCONF_OBJS) $(LIBS)

# stuff in contrib/

$(IRCDWATCH): ircdwatch.o clsupport.o clmatch.o
	$(RM) $(IRCDWATCH)
	$(CC) $(LDFLAGS) -o $(IRCDWATCH) clsupport.o clmatch.o ircdwatch.o $(LIBS)

ircd-mkpasswd: mkpasswd.o
	$(RM) ircd-mkpasswd
	$(CC) $(LDFLAGS) -o ircd-mkpasswd mkpasswd.o $(LIBS)

install: install-server @install_locale@

install-server: server
	-@if [ ! -d $(server_bin_dir)/. ]; then \
		$(MKDIRHIER) $(server_bin_dir); \
	fi
	-@if [ ! -d $(server_man_dir)/. ]; then \
		$(MKDIRHIER) $(server_man_dir); \
	fi
	-@if [ ! -d $(conf_man_dir)/. ]; then \
		$(MKDIRHIER) $(conf_man_dir); \
	fi
	-@if [ ! -d $(ircd_conf_dir)/. ]; then \
		$(MKDIRHIER) $(ircd_conf_dir); \
	fi
	-@if [ ! -d $(ircd_var_dir)/. ]; then \
		$(MKDIRHIER) $(ircd_var_dir); \
	fi
	-@if [ ! -d $(ircd_log_dir)/. ]; then \
		$(MKDIRHIER) $(ircd_log_dir); \
	fi
	-@if [ -n "@oldconvobjs@" ]; then \
		if [ ! -d $(ircd_codepage_dir) ]; then \
			$(MKDIRHIER) $(ircd_codepage_dir); \
		fi; \
	fi
	$(INSTALL_PROGRAM) -m $(ircd_mode) $(SERVER) $(server_bin_dir)
	$(INSTALL_PROGRAM) -m $(ircd_mode) $(IAUTH) $(server_bin_dir)
	$(INSTALL_PROGRAM) -m $(ircd_mode) $(ISERV) $(server_bin_dir)
	$(INSTALL_PROGRAM) -m $(ircd_mode) $(CHKCONF) $(server_bin_dir)
	$(INSTALL_PROGRAM) -m $(ircd_mode) ircd-mkpasswd $(server_bin_dir)
	$(INSTALL_PROGRAM) -m $(ircd_mode) $(IRCDWATCH) $(server_bin_dir)
	$(RM) $(IRCDM4_PATH)
	../ircd/buildm4 $(IRCDM4_PATH)
	$(INSTALL_DATA) ../doc/ircd.8 $(server_man_dir)
	$(INSTALL_DATA) ../doc/iauth.8 $(server_man_dir)
	$(INSTALL_DATA) ../doc/iauth.conf.5 $(conf_man_dir)
	$(INSTALL_DATA) ../contrib/ircdwatch/ircdwatch.8 $(server_man_dir)
	$(INSTALL_DATA) ../doc/example.conf $(ircd_conf_dir)
	-@if [ -n "@oldconvobjs@" ]; then \
		$(INSTALL_DATA) ../doc/example.rusnet.conf $(ircd_conf_dir); \
		$(INSTALL_DATA) ../codepages.universal/*UNI* $(ircd_codepage_dir); \
	fi
	$(INSTALL_DATA) ../support/ircd.rmotd $(IRCDRMOTD_PATH)
	$(INSTALL_DATA) ../support/iauth.conf $(ircd_conf_dir)/example.iauth.conf
	@echo "installation of server done."

install-locale: @irc_cv_locale@
	/bin/cp -r locale $(ircd_locale_dir)

clmatch.o: $(MATCH_DEPS) $(CLIENT_DEPS)
	$(CC) $(C_CFLAGS) -c -o $@ ../common/match.c

clsupport.o: ../common/support.c $(CLIENT_DEPS) ../common/patchlevel.h
	$(CC) $(C_CFLAGS) -c -o $@ ../common/support.c

# server stuff
dbuf.o: ../common/dbuf.c $(SERVER_DEPS)
	$(CC) $(S_CFLAGS) -c -o $@ ../common/dbuf.c

fileio.o: ../common/fileio.c $(SERVER_DEPS)
	$(CC) $(S_CFLAGS) -c -o $@ ../common/fileio.c

match.o: $(MATCH_DEPS) $(SERVER_DEPS)
	$(CC) $(S_CFLAGS) -c -o $@ ../common/match.c

packet.o: ../common/packet.c $(SERVER_DEPS)
	$(CC) $(S_CFLAGS) -c -o $@ ../common/packet.c

parse.o: ../common/parse.c $(SERVER_DEPS)
	$(CC) $(S_CFLAGS) -c -o $@ ../common/parse.c

send.o: ../common/send.c $(SERVER_DEPS)
	$(CC) $(S_CFLAGS) -DLOG_DIR="\"$(ircd_log_dir)\"" -c -o $@ ../common/send.c

support.o: ../common/support.c $(SERVER_DEPS) ../common/patchlevel.h
	$(CC) $(S_CFLAGS) -c -o $@ ../common/support.c

conversion.o: ../common/conversion.c $(SERVER_DEPS)
	$(CC) $(S_CFLAGS) -c -o $@ ../common/conversion.c

channel.o: ../ircd/channel.c $(SERVER_DEPS)
	$(CC) $(S_CFLAGS) -c -o $@ ../ircd/channel.c

class.o: ../ircd/class.c $(SERVER_DEPS)
	$(CC) $(S_CFLAGS) -c -o $@ ../ircd/class.c

hash.o: ../common/struct_def.h ../common/os.h ../ircd/hash_def.h \
	../ircd/hash_ext.h ../common/common_def.h ../ircd/s_bsd.c \
	../ircd/s_serv.c ../ircd/s_user.c ../ircd/channel.c ../ircd/s_misc.c \
	../ircd/hash.c ../ircd/ircd.c Makefile $(SERVER_DEPS)
	@cp ../ircd/hash.c .
	@/bin/sh ./sums
	$(CC) $(S_CFLAGS) -c -o $@ hash.c
	@$(RM) hash.c hash.c.old
	@touch hash.o

ircd.o: ../ircd/ircd.c $(SERVER_DEPS)
	$(CC) $(S_CFLAGS) -DIRCDCONF_PATH="\"$(IRCDCONF_PATH)\"" \
	-DRUSNETCONF_PATH="\"$(RUSNETCONF_PATH)\"" \
	-DIRCDTUNE_PATH="\"$(IRCDTUNE_PATH)\"" \
	-DIRCDMOTD_PATH="\"$(IRCDMOTD_PATH)\"" \
	-DIRCDRMOTD_PATH="\"$(IRCDRMOTD_PATH)\"" \
	-DLOCPATH="\"$(ircd_locale_dir)/locale\"" \
	-DIRCD_PATH="\"$(IRCD_PATH)\"" -DIAUTH_PATH="\"$(IAUTH_PATH)\"" \
	-DIAUTH="\"$(IAUTH)\"" -DISERV_PATH="\"$(ISERV_PATH)\"" \
	-DISERV="\"$(ISERV)\"" -DIRCDDBG_PATH="\"$(IRCDDBG_PATH)\"" -c -o $@ ../ircd/ircd.c

ircd_signal.o: ../ircd/ircd_signal.c $(SERVER_DEPS)
	$(CC) $(S_CFLAGS) -c -o $@ ../ircd/ircd_signal.c

list.o: ../ircd/list.c $(SERVER_DEPS)
	$(CC) $(S_CFLAGS) -c -o $@ ../ircd/list.c

res.o: ../ircd/res.c $(SERVER_DEPS)
	$(CC) $(S_CFLAGS) -c -o $@ ../ircd/res.c

s_auth.o: ../ircd/s_auth.c $(SERVER_DEPS)
	$(CC) $(S_CFLAGS) -c -o $@ ../ircd/s_auth.c

s_iserv.o: ../ircd/s_iserv.c $(SERVER_DEPS)
	$(CC) $(S_CFLAGS) -c -o $@ ../ircd/s_iserv.c

s_bsd.o: ../ircd/s_bsd.c $(SERVER_DEPS)
	$(CC) $(S_CFLAGS) -DIRCDPID_PATH="\"$(IRCDPID_PATH)\"" \
	-DISERV_PATH="\"$(ISERV_PATH)\"" -DISERV="\"$(ISERV)\""	\
	-DIAUTH_PATH="\"$(IAUTH_PATH)\"" -DIAUTH="\"$(IAUTH)\"" -c -o $@ ../ircd/s_bsd.c

s_conf.o: ../ircd/s_conf.c $(SERVER_DEPS) ../ircd/config_read.c
	$(CC) $(S_CFLAGS) -DIRCDMOTD_PATH="\"$(IRCDMOTD_PATH)\"" \
	-DIRCDM4_PATH="\"$(IRCDM4_PATH)\"" -DIRCDCONF_PATH="\"$(IRCDCONF_PATH)\"" \
	-DIRCDCONF_DIR="\"$(ircd_conf_dir)/\"" \
	-DM4_PATH="\"$(M4_PATH)\"" -c -o $@ ../ircd/s_conf.c

s_debug.o: ../ircd/s_debug.c $(SERVER_DEPS)
	$(CC) $(S_CFLAGS) -c -o $@ ../ircd/s_debug.c

s_err.o: ../ircd/s_err.c $(SERVER_DEPS) ../common/patchlevel.h
	$(CC) $(S_CFLAGS) -c -o $@ ../ircd/s_err.c

s_id.o: ../ircd/s_id.c $(SERVER_DEPS)
	$(CC) $(S_CFLAGS) -c -o $@ ../ircd/s_id.c

s_misc.o: ../ircd/s_misc.c $(SERVER_DEPS)
	$(CC) $(S_CFLAGS) -c -o $@ ../ircd/s_misc.c

s_numeric.o: ../ircd/s_numeric.c $(SERVER_DEPS)
	$(CC) $(S_CFLAGS) -c -o $@ ../ircd/s_numeric.c

s_serv.o: ../ircd/s_serv.c $(SERVER_DEPS)
	$(CC) $(S_CFLAGS) -c -o $@ ../ircd/s_serv.c

s_service.o: ../ircd/s_service.c $(SERVER_DEPS)
	$(CC) $(S_CFLAGS) -c -o $@ ../ircd/s_service.c

s_user.o: ../ircd/s_user.c $(SERVER_DEPS)
	$(CC) $(S_CFLAGS) -DLOG_DIR="\"$(ircd_log_dir)\"" \
				-c -o $@ ../ircd/s_user.c

ssl.o: ../ircd/ssl.c $(SERVER_DEPS)
	$(CC) $(S_CFLAGS) -DIRCDCONF_DIR="\"$(ircd_conf_dir)\"" \
				-c -o $@ ../ircd/ssl.c

s_zip.o: ../ircd/s_zip.c $(SERVER_DEPS)
	$(CC) $(S_CFLAGS) -c -o $@ ../ircd/s_zip.c

rusnet_codepages.o: ../rusnet/rusnet_codepages.c $(SERVER_DEPS)
	$(CC) $(S_CFLAGS) -c -o $@ ../rusnet/rusnet_codepages.c

rusnet_init.o: ../rusnet/rusnet_init.c $(SERVER_DEPS)
	$(CC) $(S_CFLAGS) -c -o $@ ../rusnet/rusnet_init.c

rusnet_misc.o: ../rusnet/rusnet_misc.c $(SERVER_DEPS)
	$(CC) $(S_CFLAGS) -c -o $@ ../rusnet/rusnet_misc.c

rusnet_cmds.o: ../rusnet/rusnet_cmds.c $(SERVER_DEPS)
	$(CC) $(S_CFLAGS) -c -o $@ ../rusnet/rusnet_cmds.c

rusnet_virtual.o: ../rusnet/rusnet_virtual.c $(SERVER_DEPS)
	$(CC) $(S_CFLAGS) -c -o $@ ../rusnet/rusnet_virtual.c

whowas.o: ../ircd/whowas.c $(SERVER_DEPS)
	$(CC) $(S_CFLAGS) -c -o $@ ../ircd/whowas.c

res_init.o: ../ircd/res_init.c $(SERVER_DEPS)
	$(CC) $(S_CFLAGS) -c -o $@ ../ircd/res_init.c

res_comp.o: ../ircd/res_comp.c $(SERVER_DEPS)
	$(CC) $(S_CFLAGS) -c -o $@ ../ircd/res_comp.c

res_mkquery.o: ../ircd/res_mkquery.c $(SERVER_DEPS)
	$(CC) $(S_CFLAGS) -c -o $@ ../ircd/res_mkquery.c

# iauth stuff
iauth.o: ../iauth/iauth.c $(IAUTH_DEPS)
	$(CC) $(A_CFLAGS) -c -o $@ ../iauth/iauth.c

a_conf.o: ../iauth/a_conf.c $(IAUTH_DEPS)
	$(CC) $(A_CFLAGS) -DIAUTHCONF_PATH="\"$(IAUTHCONF_PATH)\"" \
			  -c -o $@ ../iauth/a_conf.c

a_dyn.o: ../iauth/a_dyn.c $(IAUTH_DEPS)
	$(CC) $(A_CFLAGS) -c -o $@ ../iauth/a_dyn.c

a_io.o: ../iauth/a_io.c $(IAUTH_DEPS)
	$(CC) $(A_CFLAGS) -c -o $@ ../iauth/a_io.c

a_log.o: ../iauth/a_log.c $(IAUTH_DEPS)
	$(CC) $(A_CFLAGS) -DIAUTHDBG_PATH="\"$(IAUTHDBG_PATH)\"" \
	-DLOG_DIR="\"$(ircd_log_dir)\"" -c -o $@ ../iauth/a_log.c

mod_lhex.o: ../iauth/mod_lhex.c $(IAUTH_DEPS)
	$(CC) $(A_CFLAGS) -c -o $@ ../iauth/mod_lhex.c

mod_pipe.o: ../iauth/mod_pipe.c $(IAUTH_DEPS)
	$(CC) $(A_CFLAGS) -c -o $@ ../iauth/mod_pipe.c

mod_rfc931.o: ../iauth/mod_rfc931.c $(IAUTH_DEPS)
	$(CC) $(A_CFLAGS) -c -o $@ ../iauth/mod_rfc931.c

mod_socks.o: ../iauth/mod_socks.c $(IAUTH_DEPS)
	$(CC) $(A_CFLAGS) -c -o $@ ../iauth/mod_socks.c

mod_webproxy.o: ../iauth/mod_webproxy.c $(IAUTH_DEPS)
	$(CC) $(A_CFLAGS) -c -o $@ ../iauth/mod_webproxy.c

mod_dnsbl.o: ../iauth/mod_dnsbl.c $(IAUTH_DEPS)
	$(CC) $(A_CFLAGS) -c -o $@ ../iauth/mod_dnsbl.c

# iserv stuff
iserv.o: ../iserv/iserv.c $(ISERV_DEPS)
	$(CC) $(IS_CFLAGS) -DKILLSCONF_PATH="\"$(KILLSCONF_PATH)\"" -c -o $@ ../iserv/iserv.c

i_io.o: ../iserv/i_io.c $(ISERV_DEPS)
	$(CC) $(IS_CFLAGS) -c -o $@ ../iserv/i_io.c

i_log.o: ../iserv/i_log.c $(ISERV_DEPS)
	$(CC) $(IS_CFLAGS) -DISERVDBG_PATH="\"$(ISERVDBG_PATH)\"" \
	-DLOG_DIR="\"$(ircd_log_dir)\"" -c -o $@ ../iserv/i_log.c


chkconf.o: ../ircd/chkconf.c $(SERVER_DEPS) ../ircd/config_read.c
	$(CC) $(CC_CFLAGS) -DCHKCONF_COMPILE -DIRCDCONF_PATH="\"$(IRCDCONF_PATH)\"" \
	-DIRCDCONF_DIR="\"$(ircd_conf_dir)/\"" \
	-DM4_PATH="\"$(M4_PATH)\"" -DIRCDM4_PATH="\"$(IRCDM4_PATH)\"" -c -o $@ ../ircd/chkconf.c

# stuff in contrib/

ircdwatch.o: ../contrib/ircdwatch/ircdwatch.c
	$(CC) $(O_CFLAGS) -DIRCDWATCH_PID_FILENAME="\"$(IRCDWATCHPID_PATH)\"" \
	-DIRCD_PATH="\"$(IRCD_PATH)\"" -DIRCDPID_PATH="\"$(IRCDPID_PATH)\"" \
	-c -o $@ ../contrib/ircdwatch/ircdwatch.c

mkpasswd.o: ../contrib/mkpasswd/mkpasswd.c
	$(CC) $(O_CFLAGS) -c -o $@ ../contrib/mkpasswd/mkpasswd.c

clean:
	$(RM) $(CLIENT) $(SERVER) $(IAUTH) $(ISERV) $(CHKCONF) ircd-mkpasswd \
	$(IRCDWATCH) *.CKP *.ln *.BAK *.bak *.o core errs \
	,* *~ *.a .emacs_* tags TAGS make.log MakeOut "#"* version.c

distclean:
	$(RM) ../common/conversion.h
	@echo "To make distclean, just delete the current directory."

rcs:
	(cd ..; cii -H -R configure common doc include ircd support)
